#!/usr/bin/bash

dir=$1
cmd=$2

if [ ! $dir ];then
    echo "ERROR: 需要一个dir参数" 
    exit 1
fi
if [ ! $cmd ];then
    echo "ERROR: 需要一个cmd参数" 
    exit 1
fi

tar czf $dir.tgz $dir

sed -i "/^dir/c\\dir=$1" exec.sh
sed -i "/^cmd/c\\cmd=$2" exec.sh

cat exec.sh $dir.tgz > $dir.sh